﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Reflection;
using ZXCompany.Models.Entity;
using ZXCompany.Models.Service;
namespace ZXCompany.Controllers
{
    public class BusinessController : Controller
    {
        //
        // GET: /Business/
        private static readonly log4net.ILog logger = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
        ServiceFactory serfac = new ServiceFactory();
        //private List<
        /// <summary>
        /// 业务领域（整体Image）
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            try
            {
                //ViewData["Message"] = "欢迎使用 ASP.NET MVC!";mainmenu_a/activemenu
                //网站首页
                ViewData["IndexTitleClass"] = "mainmenu_a";
                //关于我们
                ViewData["AboutTitleClass"] = "mainmenu_a";
                //业务领域
                ViewData["BusinessTitleClass"] = "activemenu";
                //解决方案
                ViewData["SolutionTitleClass"] = "mainmenu_a";
                //动态前沿
                ViewData["ActiveTitleClass"] = "mainmenu_a";
                //联系我们
                ViewData["ContUsTitleClass"] = "mainmenu_a";
                //获取整体image
                ZX_WholeInfo winfo = serfac.GetBusinessService().GetWholeInfo();
                ViewData["WholeInfo"] = winfo;
                return View("Index");
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                return View("Error");
            }
        }

        /// <summary>
        /// 业务领域（战略咨询）
        /// </summary>
        /// <returns></returns>
        public ActionResult StratagemQuestion()
        {
            try
            {
                //ViewData["Message"] = "欢迎使用 ASP.NET MVC!";mainmenu_a/activemenu
                //网站首页
                ViewData["IndexTitleClass"] = "mainmenu_a";
                //关于我们
                ViewData["AboutTitleClass"] = "mainmenu_a";
                //业务领域
                ViewData["BusinessTitleClass"] = "activemenu";
                //解决方案
                ViewData["SolutionTitleClass"] = "mainmenu_a";
                //动态前沿
                ViewData["ActiveTitleClass"] = "mainmenu_a";
                //联系我们
                ViewData["ContUsTitleClass"] = "mainmenu_a";
                //获取战略咨询
                ZX_WholeInfoStrategy wstrategy = serfac.GetBusinessService().GetWholeStrategy();
                ViewData["WholeStrategy"] = wstrategy;
                return View();
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                return View("Error");
            }
        }

        /// <summary>
        /// 业务领域（精益生产）
        /// </summary>
        /// <returns></returns>
        public ActionResult PlustekProduction()
        {
            try
            {
                //ViewData["Message"] = "欢迎使用 ASP.NET MVC!";mainmenu_a/activemenu
                //网站首页
                ViewData["IndexTitleClass"] = "mainmenu_a";
                //关于我们
                ViewData["AboutTitleClass"] = "mainmenu_a";
                //业务领域
                ViewData["BusinessTitleClass"] = "activemenu";
                //解决方案
                ViewData["SolutionTitleClass"] = "mainmenu_a";
                //动态前沿
                ViewData["ActiveTitleClass"] = "mainmenu_a";
                //联系我们
                ViewData["ContUsTitleClass"] = "mainmenu_a";
                //获取精益生产
                ZX_Product pro = serfac.GetBusinessService().GetProduct();
                ViewData["pro"] = pro;
                return View();
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                return View("Error");
            }
        }

        /// <summary>
        /// 业务领域（品质改善）
        /// </summary>
        /// <returns></returns>
        public ActionResult QualityChange()
        {
            try
            {
                //ViewData["Message"] = "欢迎使用 ASP.NET MVC!";mainmenu_a/activemenu
                //网站首页
                ViewData["IndexTitleClass"] = "mainmenu_a";
                //关于我们
                ViewData["AboutTitleClass"] = "mainmenu_a";
                //业务领域
                ViewData["BusinessTitleClass"] = "activemenu";
                //解决方案
                ViewData["SolutionTitleClass"] = "mainmenu_a";
                //动态前沿
                ViewData["ActiveTitleClass"] = "mainmenu_a";
                //联系我们
                ViewData["ContUsTitleClass"] = "mainmenu_a";
                ZX_QualityChange qc = serfac.GetAccount().QualityChangeSelect();
                ViewData["qc"] = qc;
                return View();
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                return View("Error");
            }
        }

        /// <summary>
        /// 业务领域（培训中心）
        /// </summary>
        /// <returns></returns>
        public ActionResult TrainCenter()
        {
            try
            {
                //ViewData["Message"] = "欢迎使用 ASP.NET MVC!";mainmenu_a/activemenu
                //网站首页
                ViewData["IndexTitleClass"] = "mainmenu_a";
                //关于我们
                ViewData["AboutTitleClass"] = "mainmenu_a";
                //业务领域
                ViewData["BusinessTitleClass"] = "activemenu";
                //解决方案
                ViewData["SolutionTitleClass"] = "mainmenu_a";
                //动态前沿
                ViewData["ActiveTitleClass"] = "mainmenu_a";
                //联系我们
                ViewData["ContUsTitleClass"] = "mainmenu_a";
                //获取培训列表
                List<ZX_TrainList> ltrain = serfac.GetBusinessService().GetTrainList();
                ViewData["ltrain"] = ltrain;
                ZX_TrainInfo tinfo = serfac.GetBusinessService().GetTrainInfo();
                ViewData["traininfo"] = tinfo;
                return View();
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                return View("Error");
            }
        }
        /// <summary>
        /// 每一个的培训详细信息
        /// </summary>
        /// <returns></returns>
        public ActionResult TrainDetail()
        {
            try
            {
                //ViewData["Message"] = "欢迎使用 ASP.NET MVC!";mainmenu_a/activemenu
                //网站首页
                ViewData["IndexTitleClass"] = "mainmenu_a";
                //关于我们
                ViewData["AboutTitleClass"] = "mainmenu_a";
                //业务领域
                ViewData["BusinessTitleClass"] = "activemenu";
                //解决方案
                ViewData["SolutionTitleClass"] = "mainmenu_a";
                //动态前沿
                ViewData["ActiveTitleClass"] = "mainmenu_a";
                //联系我们
                ViewData["ContUsTitleClass"] = "mainmenu_a";

                //trinlistid
                int tid = Convert.ToInt32(Request.QueryString["trainid"]);
                //获取培训列表
                ZX_TrainList ltrain = serfac.GetBusinessService().GetTrainListById(tid);
                ViewData["trainl"] = ltrain;
                
                return View();
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                return View("Error");
            }
        }

        /// <summary>
        /// 业务领域（信息技术）
        /// </summary>
        /// <returns></returns>
        public ActionResult InfomaitionSkill()
        {
            try
            {
                //ViewData["Message"] = "欢迎使用 ASP.NET MVC!";mainmenu_a/activemenu
                //网站首页
                ViewData["IndexTitleClass"] = "mainmenu_a";
                //关于我们
                ViewData["AboutTitleClass"] = "mainmenu_a";
                //业务领域
                ViewData["BusinessTitleClass"] = "activemenu";
                //解决方案
                ViewData["SolutionTitleClass"] = "mainmenu_a";
                //动态前沿
                ViewData["ActiveTitleClass"] = "mainmenu_a";
                //联系我们
                ViewData["ContUsTitleClass"] = "mainmenu_a";
                //信息技术
                ZX_InfoSkill infoskill= serfac.GetBusinessService().GetInfoSkill();
                ViewData["infoskill"] = infoskill;
                return View();
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                return View("Error");
            }
        }

    }
}
